package day03;

import java.util.Scanner;

//if...else if结构得演示
public class IfElseIfDome {
    public static void main(String[] args) {
        /*
            3.if...else if 结构:多分支
                1)语法:
                    if(boolean-1){
                        语句块1
                    }else if(boolean-2){
                        语句块2
                    }else if(boolean-3){
                        语句块3
                    }else{
                    }
                 2)执行过程:
                     判断boolean-1,若为true则执行语句块1(结束);
                     若为false则在判断boolean-2,若为true则执行
                     语句块2(结束)..........
                 3)说明:
                     语句块1/2/3/4
         */
        //满2000打5折,满1000不满2000打7折,满500不满1000打8折,不满500打9折

        for (int i = 0; i < 5; i++) {
            double price;
            Scanner sc = new Scanner(System.in);
            System.out.print("消费价格为:");
            price = sc.nextDouble();
            if (price >= 2000) {
                price *= 0.5;
            } else if (price >= 1000 && price < 2000) {
                price *= 0.7;
            } else if (price >= 500 && price < 1000) {
                price *= 0.8;
            } else {
                price *= 0.9;
            }
            System.out.println("最终价格为:" + price + '\n');
        }













    }
}
